-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Added metadata for complextypes for AddViews / TVF in RelationalModel #36894 , execute update for complex types (view+table) #34706 #37072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added metadata for complextypes for AddViews / TVF in RelationalModel #36894 , execute update for complex types (view+table) #34706 #37072
Conversation
Added metadata for complextypes for AddViews in RelationalModel
This reverts commit a4f32d1.
…d setting the complextype itself
removed comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for complex types in views and table-valued functions (TVFs) in the relational model, and enables ExecuteUpdate operations on entities with complex types that have view mappings. The changes fix issues #36894 and #34706.
- Modified the
ViewMappingconstructor to acceptITypeBaseinstead ofIEntityType, allowing complex types to be mapped to views - Updated the relational model generation to create view mappings for complex types
- Enhanced ExecuteUpdate to properly handle complex types with view mappings by utilizing table mappings when views are encountered
- Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/EFCore.Relational/Metadata/Internal/ViewMapping.cs | Changed constructor parameter from IEntityType to ITypeBase to support complex types |
| src/EFCore.Relational/Metadata/Internal/RelationalModel.cs | Added logic to create view mappings for complex types recursively, similar to table mappings |
| src/EFCore.Relational/Metadata/Internal/RelationalTypeBaseExtensions.cs | Refactored GetViewOrTableMappings for clarity with intermediate variables |
| src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteUpdate.cs | Added ProcessColumn call and fixed ProcessComplexType to handle view-to-table translation for complex types |
| test/EFCore.Relational.Specification.Tests/Query/UdfDbFunctionTestBase.cs | Added ComplexGpsCoordinates complex type, MapLocation entity, and test for TVF with complex types mapped to views |
| test/EFCore.Relational.Specification.Tests/BulkUpdates/NonSharedModelBulkUpdatesRelationalTestBase.cs | Removed exception assertion and added new test for updating individual complex type properties with view mappings |
| test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs | Added SQL assertions for ExecuteUpdate operations on complex types with view mappings |
| test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs | Added SQL assertions for SQLite-specific ExecuteUpdate with complex type view mappings |
| test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs | Added SQL assertion for TVF test with complex types |
| test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/ComplexTypes/DbContextModelBuilder.cs | Updated baseline with view column and mapping metadata for complex types |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
...Core.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteUpdate.cs
Outdated
Show resolved
Hide resolved
AndriySvyryd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add complex types and asserts to tests for view and TVF mapping in https://github.com/dotnet/efcore/blob/main/test/EFCore.Relational.Tests/Metadata/RelationalModelTest.cs
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
done. |
|
Thanks for your contribution! |
Fixes #36894 , #34706